﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhysioAssist2
{
    public partial class AdminPacientes : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) CarregaPacientes();
        }


        private void CarregaPacientes()
        {

            WS ws = new WS();
            List<Paciente> lst = ws.ListaPacientes();

            foreach (Paciente pac in lst)
            {

                HyperLink lnk = new HyperLink();
                HyperLink lnkimg = new HyperLink();
                Image img = new Image();
                Panel pnl = new Panel();

                pnl.CssClass = "paciente";

                img.ImageUrl = pac.foto;
                lnkimg.NavigateUrl = "AdminPacientesEditar.aspx?id=" + pac.id;
                lnkimg.Controls.Add(img);
                pnl.Controls.Add(lnkimg);

                lnk.Text = pac.nome + "<br />" + "<br />";
                lnk.NavigateUrl = "AdminPacientesEditar.aspx?id=" + pac.id;
                pnl.Controls.Add(lnk);


                divPacientes.Controls.Add(pnl);

            }

        }

        protected void btnNovo_Click(object sender, EventArgs e)
        {
            Response.Redirect("AdminPacientesEditar.aspx");
        }
    }
}